#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "toolbars.h"
#include "videomerge.h"
#include "audiovideodivision.h"
#include "audiovideomerge.h"
#include "addeffect.h"
#include <QWidget>
#include <QPushButton>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //this->setWindowTitle("VideoTool");

    QColor color = QColor("#222222");
    QPalette p = this->palette();
    p.setColor(QPalette::Window, color);
    this->setPalette(p);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_Close_triggered()
{
    exit(0);
}

void MainWindow::on_About_triggered()
{
    ;
}

void MainWindow::on_Split_triggered()
{
    if (this->FunctionChosen)
    {
        this->ui->verticalLayout->removeWidget(this->ToolBar);
        delete this->ToolBar;
    }
    this->FunctionChosen = true;
    this->ToolBar = new ToolBars;
    this->ui->verticalLayout->addWidget(this->ToolBar);
    //
}

void MainWindow::on_VideoMerge_triggered()
{
    if (this->FunctionChosen)
    {
        this->ui->verticalLayout->removeWidget(this->ToolBar);
        delete this->ToolBar;
    }
    this->FunctionChosen = true;
    this->ToolBar = new VideoMerge;
    this->ui->verticalLayout->addWidget(this->ToolBar);
    //this->update();
}

void MainWindow::on_AudioVideoSplit_triggered()
{
    if (this->FunctionChosen)
    {
        this->ui->verticalLayout->removeWidget(this->ToolBar);
        delete this->ToolBar;
    }
    this->FunctionChosen = true;
    this->ToolBar = new AudioVideoDivision;
    this->ui->verticalLayout->addWidget(this->ToolBar);
    //this->update();
}

void MainWindow::on_AudioVideoMerge_triggered()
{
    if (this->FunctionChosen)
    {
        this->ui->verticalLayout->removeWidget(this->ToolBar);
        delete this->ToolBar;
    }
    this->FunctionChosen = true;
    this->ToolBar = new AudioVideoMerge;
    this->ui->verticalLayout->addWidget(this->ToolBar);
    //this->update();
}

void MainWindow::on_AddEffects_triggered()
{
    if (this->FunctionChosen)
    {
        this->ui->verticalLayout->removeWidget(this->ToolBar);
        delete this->ToolBar;
    }
    this->FunctionChosen = true;
    this->ToolBar = new AddEffect;
    this->ui->verticalLayout->addWidget(this->ToolBar);
    //this->update();
}
